/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Anamnesa.java
 *
 * Created on Oct 7, 2012, 3:41:24 PM
 */
package View;

//import Connection.ConnOracle;
//import Controller.ControlData;
//import Data.*;
//import TableModel.ResepTableModel;
import java.sql.Connection;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
//import net.sf.jasperreports.engine.JRException;
//import net.sf.jasperreports.engine.JasperFillManager;
//import net.sf.jasperreports.engine.JasperPrint;
//import net.sf.jasperreports.view.JasperViewer;

/**
 *
 * @author a9uszT
 */
public class resepObat extends javax.swing.JFrame {

    /**
     * Creates new form Anamnesa
     */
    public resepObat() {
        
        initComponents();
//        isiKategori();
        GregorianCalendar gc = new GregorianCalendar();
        date_resep.setDate(gc.getTime());
        idDokterRM.setText(RekamMedis.idDokterRM.getText());
        namaDokter.setText(RekamMedis.namaDokter.getText());
        jInternalFrame1.setVisible(false);
        simpan_button.setEnabled(false);
//        tampilTableRM();
        
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jInternalFrame1 = new javax.swing.JInternalFrame();
        jPanel2 = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        jLabel22 = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        idresepCetak = new javax.swing.JTextField();
        jLabel27 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        table_resep = new javax.swing.JTable();
        cetak_button1 = new javax.swing.JButton();
        back_button = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        LihatResep = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        simpan_button = new javax.swing.JButton();
        edit_button = new javax.swing.JButton();
        exit_button = new javax.swing.JButton();
        kirim_button = new javax.swing.JButton();
        obat_combobox = new javax.swing.JComboBox();
        jLabel5 = new javax.swing.JLabel();
        jumlah_combobx = new javax.swing.JComboBox();
        tambah_button = new javax.swing.JButton();
        jLabel6 = new javax.swing.JLabel();
        dosis_cmbobx = new javax.swing.JComboBox();
        jScrollPane3 = new javax.swing.JScrollPane();
        obat_textarea = new javax.swing.JTextArea();
        jPanel5 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        jLabel19 = new javax.swing.JLabel();
        idResepTF = new javax.swing.JTextField();
        idPasienTF = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        date_resep = new com.toedter.calendar.JDateChooser();
        jLabel21 = new javax.swing.JLabel();
        idDokterRM = new javax.swing.JTextField();
        namaDokter = new javax.swing.JTextField();
        jLabel28 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jInternalFrame1.setVisible(false);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        jPanel6.setBackground(new java.awt.Color(255, 255, 255));
        jPanel6.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel22.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
        jLabel22.setText("Sistem Informasi Rekam Medis");
        jPanel6.add(jLabel22, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 10, 385, 35));

        jLabel23.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
        jLabel23.setText("Poliklinik Sanata Dharma");
        jPanel6.add(jLabel23, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 50, -1, 28));

        jLabel24.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel24.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel24.setText("Jl. paingan, Maguwoharjo");
        jPanel6.add(jLabel24, new org.netbeans.lib.awtextra.AbsoluteConstraints(-3, 90, 630, -1));

        jLabel25.setIcon(new javax.swing.ImageIcon(getClass().getResource("/picture/usdd.gif"))); // NOI18N
        jPanel6.add(jLabel25, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 10, 100, 100));

        idresepCetak.setEnabled(false);

        jLabel27.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
        jLabel27.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel27.setText("Resep pasien");

        table_resep.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "id Obat", "nama Obat", "dosis Obat", "jumlah"
            }
        ));
        jScrollPane1.setViewportView(table_resep);

        cetak_button1.setFont(new java.awt.Font("Arial Black", 1, 14)); // NOI18N
        cetak_button1.setText("cetak");
        cetak_button1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cetak_button1ActionPerformed(evt);
            }
        });

        back_button.setFont(new java.awt.Font("Arial Black", 1, 14)); // NOI18N
        back_button.setText("keluar");
        back_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                back_buttonActionPerformed(evt);
            }
        });

        jLabel1.setText("id resep");

        LihatResep.setText("Lihat Resep");
        LihatResep.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                LihatResepActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addGap(144, 144, 144)
                .addComponent(LihatResep)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel3Layout.createSequentialGroup()
                    .addGap(16, 16, 16)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane1)
                            .addComponent(jLabel27, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addGap(48, 48, 48)
                                .addComponent(idresepCetak, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(0, 0, Short.MAX_VALUE)))
                        .addGroup(jPanel3Layout.createSequentialGroup()
                            .addGap(222, 222, 222)
                            .addComponent(cetak_button1)
                            .addGap(18, 18, 18)
                            .addComponent(back_button)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 246, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGap(17, 17, 17)))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(LihatResep))
                .addContainerGap(290, Short.MAX_VALUE))
            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel3Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(idresepCetak, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18)
                    .addComponent(jLabel27, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 71, Short.MAX_VALUE)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(cetak_button1)
                        .addComponent(back_button))
                    .addContainerGap()))
        );

        javax.swing.GroupLayout jInternalFrame1Layout = new javax.swing.GroupLayout(jInternalFrame1.getContentPane());
        jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout);
        jInternalFrame1Layout.setHorizontalGroup(
            jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jInternalFrame1Layout.createSequentialGroup()
                .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, 683, Short.MAX_VALUE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jInternalFrame1Layout.setVerticalGroup(
            jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(jInternalFrame1Layout.createSequentialGroup()
                .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        getContentPane().add(jInternalFrame1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 30, 700, 480));

        jPanel1.setBackground(new java.awt.Color(0, 153, 255));
        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("resep"));

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel3.setText("pilih obat");

        simpan_button.setFont(new java.awt.Font("Arial Black", 1, 14)); // NOI18N
        simpan_button.setText("simpan");
        simpan_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                simpan_buttonActionPerformed(evt);
            }
        });

        edit_button.setFont(new java.awt.Font("Arial Black", 1, 14)); // NOI18N
        edit_button.setText("edit");
        edit_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                edit_buttonActionPerformed(evt);
            }
        });

        exit_button.setFont(new java.awt.Font("Arial Black", 1, 14)); // NOI18N
        exit_button.setText("Keluar");
        exit_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exit_buttonActionPerformed(evt);
            }
        });

        kirim_button.setFont(new java.awt.Font("Arial Black", 1, 14)); // NOI18N
        kirim_button.setText("Kirim ke Apotik");
        kirim_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                kirim_buttonActionPerformed(evt);
            }
        });

        obat_combobox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                obat_comboboxActionPerformed(evt);
            }
        });

        jLabel5.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel5.setText("jumlah");

        jumlah_combobx.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", " " }));

        tambah_button.setText("tambah");
        tambah_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tambah_buttonActionPerformed(evt);
            }
        });

        jLabel6.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel6.setText("dosis");

        dosis_cmbobx.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "3 x 1", "2 x 1", "3 x 3", " ", " " }));

        obat_textarea.setColumns(20);
        obat_textarea.setRows(5);
        obat_textarea.setEnabled(false);
        jScrollPane3.setViewportView(obat_textarea);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(obat_combobox, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(30, 30, 30)
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jumlah_combobx, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(33, 33, 33)
                        .addComponent(jLabel6)
                        .addGap(27, 27, 27)
                        .addComponent(dosis_cmbobx, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(46, 46, 46)
                        .addComponent(tambah_button))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(76, 76, 76)
                        .addComponent(jScrollPane3))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(37, 37, 37)
                        .addComponent(simpan_button)
                        .addGap(27, 27, 27)
                        .addComponent(edit_button)
                        .addGap(125, 125, 125)
                        .addComponent(kirim_button)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(exit_button)))
                .addGap(221, 221, 221))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(obat_combobox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jumlah_combobx, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tambah_button)
                    .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(dosis_cmbobx, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(13, 13, 13)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(simpan_button)
                    .addComponent(edit_button)
                    .addComponent(kirim_button)
                    .addComponent(exit_button))
                .addGap(279, 279, 279))
        );

        getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 270, 780, 310));

        jPanel5.setBackground(new java.awt.Color(255, 255, 255));
        jPanel5.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 30)); // NOI18N
        jLabel2.setForeground(new java.awt.Color(255, 255, 255));
        jLabel2.setText("Sistem Informasi Rekam Medis");
        jPanel5.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 20, 490, 50));

        jLabel4.setBackground(new java.awt.Color(255, 255, 255));
        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
        jLabel4.setForeground(new java.awt.Color(255, 255, 255));
        jLabel4.setText("Poliklinik Sanata Dharma");
        jPanel5.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(300, 70, -1, 28));

        jLabel15.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel15.setForeground(new java.awt.Color(255, 255, 255));
        jLabel15.setText("Jl. paingan, Maguwoharjo");
        jPanel5.add(jLabel15, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 110, -1, -1));

        jLabel16.setIcon(new javax.swing.ImageIcon(getClass().getResource("/picture/usd.gif"))); // NOI18N
        jPanel5.add(jLabel16, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 10, 150, 140));

        jLabel17.setIcon(new javax.swing.ImageIcon(getClass().getResource("/picture/Vista_Blue_Withoutlogo_1600x1200.jpg"))); // NOI18N
        jLabel17.setText("jLabel10");
        jPanel5.add(jLabel17, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 780, 170));

        getContentPane().add(jPanel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 780, -1));

        jPanel4.setBackground(new java.awt.Color(0, 153, 255));

        jLabel19.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel19.setText("id resep");

        idResepTF.setEnabled(false);
        idResepTF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                idResepTFActionPerformed(evt);
            }
        });

        idPasienTF.setEnabled(false);
        idPasienTF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                idPasienTFActionPerformed(evt);
            }
        });

        jLabel20.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel20.setText("Tanggal");

        date_resep.setEnabled(false);

        jLabel21.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel21.setText("idPasein");

        idDokterRM.setEnabled(false);

        namaDokter.setEnabled(false);

        jLabel28.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel28.setText("id Dokter-NamaDokter");

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel21)
                        .addGap(38, 38, 38)
                        .addComponent(idPasienTF, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel19)
                        .addGap(31, 31, 31)
                        .addComponent(idResepTF, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 161, Short.MAX_VALUE)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel20)
                        .addGap(117, 117, 117)
                        .addComponent(date_resep, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel28)
                        .addGap(4, 4, 4)
                        .addComponent(idDokterRM, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(10, 10, 10)
                        .addComponent(namaDokter, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(38, 38, 38))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addGap(1, 1, 1)
                                .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(date_resep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(10, 10, 10)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel28)
                            .addComponent(idDokterRM, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(namaDokter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addGap(1, 1, 1)
                                .addComponent(jLabel19))
                            .addComponent(idResepTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(9, 9, 9)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addGap(4, 4, 4)
                                .addComponent(jLabel21))
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addGap(2, 2, 2)
                                .addComponent(idPasienTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap(29, Short.MAX_VALUE))
        );

        getContentPane().add(jPanel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 170, 780, -1));

        pack();
        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        java.awt.Dimension dialogSize = getSize();
        setLocation((screenSize.width-dialogSize.width)/2,(screenSize.height-dialogSize.height)/2);
    }// </editor-fold>//GEN-END:initComponents

    private void edit_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_edit_buttonActionPerformed

        simpan_button.setText("update");
}//GEN-LAST:event_edit_buttonActionPerformed

    private void exit_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exit_buttonActionPerformed
        JOptionPane.showMessageDialog(rootPane, "selesai isi Resep ");
        dispose();
}//GEN-LAST:event_exit_buttonActionPerformed

    private void simpan_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_simpan_buttonActionPerformed
//if (obat_textarea.getText().equalsIgnoreCase("")) {
//            JOptionPane.showMessageDialog(rootPane, "Resep Obat masih Kosong\n Harap diisi dahulu",
//                    "Error Diagnosa Kosong", JOptionPane.ERROR_MESSAGE);
//        }else{
//     String asdw = obat_textarea.getText();
//        String idresep = idResepTF.getText();
//        String idpas = idPasienTF.getText();
//        String tsemp[] = asdw.split("\n");
//        for (int i = 0; i < tsemp.length; i++) {
//            Date tgl = date_resep.getDate();
//            SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yy");
//            String tglresep = sdf.format(tgl);
//            Resep rmd = new Resep();
//            rmd.setIdResep(idresep);
//            IsiResep isiRes = new IsiResep();
//            Obat obt = new Obat();
//            String resep[] = tsemp[i].split("  ");
//            String kodeObat = resep[1];
//            int jmlObat = Integer.valueOf(resep[3]);
//            String dosis = resep[4];
//            obt.setIdObat(kodeObat);
//            isiRes.setObat(obt);
//            isiRes.setJumlah(jmlObat);
//            isiRes.setDosis(dosis);
//            isiRes.setResep(rmd);
//            System.out.println(idresep + " " + kodeObat + " " + dosis + " " + jmlObat);
//            if (simpan_button.getText().startsWith("s")) {
//                try {
//                    ControlData.getKoneksi().DataResep(isiRes);
//                    JOptionPane.showMessageDialog(rootPane, "sukses masuk");
//                } catch (Exception ex) {
//                    JOptionPane.showMessageDialog(rootPane, "error :" + ex.getMessage());
//                    Logger.getLogger(Anamnesa.class.getName()).log(Level.SEVERE, null, ex);
//                }
//            } else {
//                try {
//                    ControlData.getKoneksi().DataResep(isiRes);
//                    JOptionPane.showMessageDialog(rootPane, "sukses update");
//                    simpan_button.setText("Simpan");
//                } catch (Exception ex) {
//                    JOptionPane.showMessageDialog(rootPane, "error :" + ex.getMessage());
//                    Logger.getLogger(Anamnesa.class.getName()).log(Level.SEVERE, null, ex);
//                }
//            }
//        }
//}
       



    }//GEN-LAST:event_simpan_buttonActionPerformed

    private void kirim_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_kirim_buttonActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_kirim_buttonActionPerformed

    private void idPasienTFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_idPasienTFActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_idPasienTFActionPerformed

    private void tambah_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tambah_buttonActionPerformed
        String Obat = (String) obat_combobox.getSelectedItem();
        String tempObat[] = Obat.split("-");
        String kodeObat = tempObat[0];
        String namaObt = tempObat[1];
        String jum = (String) jumlah_combobx.getSelectedItem();
        String dosis = (String) dosis_cmbobx.getSelectedItem();
        String temp = kodeObat + "  " + namaObt + "  " + jum + "  " + dosis;
        String ObatNew = "";
        ObatNew = ObatNew + "  " + temp + "\n";
        obat_textarea.setText(obat_textarea.getText() + ObatNew);
        simpan_button.setEnabled(true);

    }//GEN-LAST:event_tambah_buttonActionPerformed

    private void idResepTFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_idResepTFActionPerformed
//        try {
//            String iddata = idResepTF.getText();
//            PasienData b = ControlData.getKoneksi().getCariPasien(iddata);
//            if (b != null) {
//                String nama = b.getNama();
//                idPasienTF.setText(nama);
//            }
//        } catch (Exception ex) {
//            Logger.getLogger(diagnosa.class.getName()).log(Level.SEVERE, null, ex);
//        }
    }//GEN-LAST:event_idResepTFActionPerformed

    private void obat_comboboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_obat_comboboxActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_obat_comboboxActionPerformed

    private void cetak_button1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cetak_button1ActionPerformed
//        try {
//                String kode=idresepCetak.getText();
//                Connection kon = null;
//                String reportSource = "";
//                kon = ConnOracle.getConnections();
//                reportSource = "./reports/.jasper";
//                Map<String, Object> params = new HashMap<String, Object>();
//                params.put("pkode", kode);
//                try {
//                    JasperPrint jasperPrint = JasperFillManager.fillReport(reportSource, params, kon);
//                    JasperViewer.viewReport(jasperPrint, false);
//                } catch (JRException ex) {
//                    ex.printStackTrace();
//                }
//                this.setExtendedState(JFrame.ICONIFIED);
//            } catch (Exception ex) {
//                Logger.getLogger(resepObat.class.getName()).log(Level.SEVERE, null, ex);
//            }
    }//GEN-LAST:event_cetak_button1ActionPerformed

    private void back_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_back_buttonActionPerformed
        jInternalFrame1.setVisible(false);
    }//GEN-LAST:event_back_buttonActionPerformed

    private void LihatResepActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LihatResepActionPerformed
//       tampilTableRM();
    }//GEN-LAST:event_LihatResepActionPerformed
//    private void isiKategori() {
//        try {
//            List<Obat> katList = ControlData.getKoneksi().getAllObat();
//            for (Obat k : katList) {
//                obat_combobox.addItem(k.getIdObat() + "-" + k.getNamaObat());
//            }
//        } catch (Exception ex) {
//            Logger.getLogger(resepObat.class.getName()).log(Level.SEVERE, null, ex);
//        }
//    }

    private void empty() {
        idResepTF.setText("");
        idPasienTF.setText("");
    }

//    private  void tampilTableRM() {
//        try {
//            idresepCetak.setText(idResepTF.getText());
//            List<IsiResep> lkat = ControlData.getKoneksi().getResep(idResepTF.getText());
//            ResepTableModel KTM = new ResepTableModel(lkat);
//            table_resep.setModel(KTM);
//        } catch (Exception ex) {
//            Logger.getLogger(RekamMedis.class.getName()).log(Level.SEVERE, null, ex);
//        }
//    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Menu_Utama.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Menu_Utama.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Menu_Utama.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Menu_Utama.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new resepObat().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton LihatResep;
    private javax.swing.JButton back_button;
    private javax.swing.JButton cetak_button1;
    private com.toedter.calendar.JDateChooser date_resep;
    private javax.swing.JComboBox dosis_cmbobx;
    private javax.swing.JButton edit_button;
    private javax.swing.JButton exit_button;
    public static javax.swing.JTextField idDokterRM;
    public static javax.swing.JTextField idPasienTF;
    public static javax.swing.JTextField idResepTF;
    public static javax.swing.JTextField idresepCetak;
    private javax.swing.JInternalFrame jInternalFrame1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JComboBox jumlah_combobx;
    private javax.swing.JButton kirim_button;
    public static javax.swing.JTextField namaDokter;
    private javax.swing.JComboBox obat_combobox;
    private javax.swing.JTextArea obat_textarea;
    private javax.swing.JButton simpan_button;
    private javax.swing.JTable table_resep;
    private javax.swing.JButton tambah_button;
    // End of variables declaration//GEN-END:variables
}
